import service from "../request.js";

// 显示角色列表
function getRoleList(queryRole){
    return service({
        method:"get",
        url:'/sys/role',
        params:{
            pageNum:queryRole.currentPage,
            pageSize:queryRole.pageSize
        }
    })
}

// 新增角色
function insertRole(role){
    return service({
        method:"post",
        url:'/sys/role',
        data:role
    })
}

// 修改
function updateRole(role){
    return service({
        method:"put",
        url:'/sys/role',
        data:role
    })
}

// 删除角色
function deleteRole(id){
    return service({
        method:"delete",
        url:`/sys/role/${id}`
    })

}

// 批量删除角色
function deleteRoles(ids){
    return service({
        method:"delete",
        url:'/sys/role',
        data:ids
    })
}
//根据角色id获取权限id
function getPermissionId(id){
    return service({
        method:"get",
        url:`/sys/permission/${id}`
    })
}
// 为角色指定权限
function getPerm(id,ids){
    return service({
        method:"post",
        url:`/sys/role/${id}/perm`,
        data:ids
    })
}



export { getRoleList,insertRole,deleteRole,updateRole,deleteRoles,getPermissionId,getPerm }